/*
 * @Description:
 * @version:
 * @Author: sunqian_sr
 * @Date: 2022-12-14 19:50:55
 * @LastEditors: Andy
 * @LastEditTime: 2022-12-27 19:04:12
 */

import { Http } from '@/common/api'
// ------------菜单管理-------------------

export const menuBtnPageListUrl = '/upms/menu/page'

/**
 * 查询菜单树
 * @param param  menuTypes:1 2 查目录和菜单   1 2 3 查全部的
 * @return {*|Promise}
 */
export const apiGetMenuTree = async (param) => Http.post('/upms/menu/findMenuTree', param)

/**
 * 新增菜单
 * @param param
 * @return {*|Promise}
 */
export const apiPostAddMenu = async (params) => Http.post('/upms/menu/add', params)

/**
 * 编辑菜单
 * @param param
 * @return {*|Promise}
 */
export const apiPostEditMenu = async (params) => Http.put('/upms/menu/update', params)

/**
 * 删除
 * @param ids
 * @return {*|Promise}
 */
export const apiDeleteMenu = async (ids) => Http.delete(`/upms/menu/batch/delete/${ids}`)

/**
 * 查询菜单按钮
 * @param ids
 * @return {*|Promise}
 */
export const apiGetMenuBtn = async (id) => Http.get(`/upms/menu/findBtn/${id}`)

/**
 * 根据ID查询菜单
 * @param id
 * @return {*|Promise}
 */
export const apiGetMenuInfo = async (id) => Http.get(`/upms/menu/findById/${id}`)

// ------------角色管理-------------------
export const pageRoleUrl = '/upms/role/page'

/**
 * 新增角色
 * @param param
 * @return {*|Promise}
 */
export const apiPostAddRole = async (params) => Http.post('/upms/role/add', params)

/**
 * 编辑角色
 * @param param
 * @return {*|Promise}
 */
export const apiPostEditRole = async (params) => Http.put('/upms/role/update', params)

/**
 * 删除
 * @param ids
 * @return {*|Promise}
 */
export const apiDeleteRole = async (ids) => Http.delete(`/upms/role/batch/delete/${ids}`)

/**
 * 批量启用角色
 * @param ids
 * @return {*|Promise}
 */
export const apiPutBatchEnable = async (params) => Http.put('/upms/role/batch/enable', params)

/**
 * 批量停用角色
 * @param ids
 * @return {*|Promise}
 */
export const apiPutBatchDisable = async (params) => Http.put('/upms/role/batch/disable', params)

/**
 * 根据ID查询角色
 * @param id
 * @return {*|Promise}
 */
export const apiGetRoleInfo = async (id) => Http.get(`/upms/role/findById/${id}`)

/**
 * 角色功能权限绑定
 * @param params
 * @return {*|Promise}
 */
export const apiPostRoleMenus = async (params) => Http.post('/upms/role/menu/batch/add', params)

/**
 * 角色数据权限绑定
 * @param params
 * @return {*|Promise}
 */
export const apiPostRoleScope = async (params) => Http.post('/upms/role/scope/batch/add', params)

// 导出角色清单
export const apiRoleExportUrl = '/upms/role/exportExcel'

// 导出功能权限清单
export const apiRoleMenuExportUrl = '/upms/role/exportRoleMenu'

// 导出数据权限清单
export const apiRoleDataExportUrl = '/upms/role/exportRoleScope'

// 获取应用数据
export const apiPostApplication = async (params) => Http.post('/upms/client/page', params)
